#![cfg_attr(
    all(not(debug_assertions), target_os = "windows"),
    windows_subsystem = "windows"
)]

mod data;
mod export;
mod models;
mod pgsql;
mod utility;

fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![
            data::init,
            data::get_connections,
            data::save_connection,
            data::get_connection,
            data::get_simple_connections,
            data::delete_connection,
            pgsql::pgsql_test_connection,
            pgsql::pgsql_get_databases,
            pgsql::pgsql_get_schemas,
            pgsql::pgsql_get_tables,
            pgsql::pgsql_get_table_columns,
            pgsql::pgsql_export_db_structure,
            pgsql::pgsql_export_db_tables,
            pgsql::pgsql_schema_compare
            // pgsql::test_insert_data
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

// #[tauri::command]
// fn open_file_dialog() {
//     let path = tauri::api::dialog::blocking::FileDialogBuilder::new().save_file();
//     println!("save file = {:?}", path);
// }
// fn pg_test_db()  {

// }

// #[tauri::command]
// fn get_current_time() -> String {
//     let time = chrono::Local::now();
//     return time.format("%Y-%m-%d %H:%M:%S.%6f").to_string();
// }
